package 算法题汇总;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main01 {
    public static void main(String[] args) throws IOException {
        BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
        String[] s = sc.readLine().split(" ");
        int num = Integer.parseInt(s[0]);
        String aim = s[1].toLowerCase();
        int res = 0;
        for (int i = 0; i < num; i++) {
            if( sc.readLine().toLowerCase().contains(aim)){
                res ++;
            }
        }
        System.out.println(res);
    }
}
